# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=ruby-ipaddress
_gemname=ipaddress
pkgver=0.8.3
pkgrel=2
pkgdesc="Ruby library to handle IP addresses in a modern and productive way"
url="https://github.com/ipaddress-gem/ipaddress"
arch="noarch"
license="MIT"
depends="ruby"
checkdepends="
	ruby-minitest
	ruby-rake
	ruby-rdoc
	"
source="https://github.com/ipaddress-gem/ipaddress/archive/v$pkgver/ruby-ipaddress-$pkgver.tar.gz
	gemspec.patch
	fix-compat-fixnum.patch
	"
builddir="$srcdir/$_gemname-$pkgver"

prepare() {
	default_prepare

	sed -i '/require .bundler/d' Rakefile
}

build() {
	gem build $_gemname.gemspec
}

check() {
	rake test
}

package() {
	local gemdir="$pkgdir/$(ruby -e 'puts Gem.default_dir')"

	gem install \
		--local \
		--install-dir "$gemdir" \
		--ignore-dependencies \
		--no-document \
		--verbose \
		$_gemname

	# Remove unnecessary files and rubbish...
	cd "$gemdir"
	rm -r cache build_info doc extensions plugins
}

sha512sums="
0fbe0267f9090175bd9d6c45fd2f16f797840daf31a293688ae2342c3876be6f9e0d392951a84b15ed72852d526633aa0690cd10f3d811406eb048dd161e6255  ruby-ipaddress-0.8.3.tar.gz
1b2b6fb1c3443fec23a7ecfaebd11ae5513e0e986ad35d5f47f61e5bd1751db868ee196427e532cfa543c2a4510b78b7874b657839808962ef39d7856fb6c6ed  gemspec.patch
27cf1c5f454d09cb2d74ede2c6adf00cabe43c1bbdd2f69cb01d48fb591782d8602a63f96b7682829c8b723c9ba7d0772abd441f3ad65fb8d29a5dae9b9c6fed  fix-compat-fixnum.patch
"
